<template>
  <div class="info">
    <div class="img">
      <img :src="info.url" alt="" class="info-img" />
      <div class="tag">
        <el-tag size="small" effect="dark">
          {{ info.tags }}
        </el-tag>
      </div>
    </div>
    <div class="content">
      <div class="name">{{ info.name }}</div>
      <div
        class="btn"
        @click="copyInfo(info)"
        v-clipboard:copy="info.config"
        v-clipboard:success="onCopy"
        v-clipboard:error="onError"
      >
        <div class="copy-btn">
          <i class="el-icon-copy-document" />&nbsp;复制CS准星
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    info: {
      type: Object,
      default: () => {},
    },
  },
  methods: {
    copyInfo(item) {},
    onCopy() {
      this.$message.success("复制成功");
    },
    onError() {
      this.$message.error("复制失败");
    },
  },
};
</script>

<style scoped lang="less">
.info {
  width: 210px;
  height: 280px;
  // border: 1px solid #000;
  box-shadow: 1px 1px 10px #f2f3f5;
  border-radius: 10px;
  margin-left: 20px;
  margin-bottom: 20px;
  .img {
    width: 100%;
    height: 192px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background-color: #4b5563;
    position: relative;
    .info-img {
      width: 100%;
      height: 100%;
    }
    .tag {
      position: absolute;
      right: 10px;
      top: 10px;
    }
  }
  .content {
    padding: 10px;
    padding-top: 0;
    .name {
      color: #000;
      font-size: 18px;
      font-weight: 600;
      text-align: left;
      padding: 10px 0;
    }
    .btn {
      border: 1px solid #dcdfe6;
      border-radius: 5px;
      cursor: pointer;
      &:active {
        background-color: #dcdfe6;
      }
      .copy-btn {
        padding-left: 10px;
        padding-right: 10px;
      }
    }
  }
}
</style>